package org.hepeng.hope.dao

import org.hepeng.hope.CornerstoneApplicationTests
import org.hepeng.hope.entity.Authority
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ActiveProfiles

@ActiveProfiles(profiles = ["dev"])
internal class AuthorityDAOTest : CornerstoneApplicationTests() {

    @Autowired
    lateinit var dao: AuthorityDAO

    @Test
    fun insertTest() {
        val a1 = Authority("account:insert" , "Account数据写入权限" ).apply {
            createTime = System.currentTimeMillis()
            deleteFlag = false
        }
        dao.save(a1)
        val a2 = Authority("account:readable" , "Account数据读取权限" ).apply {
            createTime = System.currentTimeMillis()
            deleteFlag = false
        }
        dao.save(a2)


        val a3 = Authority("account:updatable" , "Account数据更新权限" ).apply {
            createTime = System.currentTimeMillis()
            deleteFlag = false
        }
        dao.save(a3)


        val a4 = Authority("account:deleteable" , "Account数据删除权限" ).apply {
            createTime = System.currentTimeMillis()
            deleteFlag = false
        }
        dao.save(a4)
    }

    @Test fun getOneTest() {
        val a = dao.getOne(1)
        println(a)
    }
}